/**
  ******************************************************************************
  * @file    Project/STM32F10x_StdPeriph_Template/main.c 
  * @author  MCD Application Team
  * @version V3.5.0
  * @date    08-April-2011
  * @brief   Main program body
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  ******************************************************************************
  */  

/* Includes ------------------------------------------------------------------*/
//#include "stm32f10x.h"
#include "System.h"
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
#include "BspLed.h"
#include "MotorsTask.h"
#include  "timer.h"
/**
  * @brief  Main program.
  * @param  None
  * @retval None
  */
volatile uint32_t millis = 0; // 记录毫秒数，需使用 volatile 关键字
volatile uint32_t led_toggle_time = 0; // 记录 LED 切换的时间

void SysTick_Handler(void) {
    millis++; // 每毫秒增加1
    if (millis >= led_toggle_time) {
        // 达到LED切换的时间
        GPIOA->ODR ^= (1 << 3); // 切换 LED 状态
        led_toggle_time = millis + 500; // 设置下一次切换的时间为当前时间加500毫秒
    }
}
int main(void)
{
	Timer_Init();
	NVIC_SetPriorityGrouping(NVIC_PriorityGroup_4);
	SysTick_Config(SystemCoreClock / 1000);
//	if(!SysInit())
//			vTaskStartScheduler();
//	else	
//	while(1);
//	MotorsTask(NULL);
////	vTaskStartScheduler();
////  /* Infinite loop */
//  while (1)
//  { 

//  }
	if(SysInit())
	{
//		while(1)
//		{
//		  
//		}
	}
//	vTaskStartScheduler();
	MotorsTask(NULL);
}



#ifdef  USE_FULL_ASSERT

/**
  * @brief  Reports the name of the source file and the source line number
  *         where the assert_param error has occurred.
  * @param  file: pointer to the source file name
  * @param  line: assert_param error line source number
  * @retval None
  */
void assert_failed(uint8_t* file, uint32_t line)
{ 
  /* User can add his own implementation to report the file name and line number,
     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

  /* Infinite loop */
  while (1)
  {
  }
}
#endif

/**
  * @}
  */


/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
